package day04;

import java.util.Random;
import java.util.Scanner;

public class Demo05Guessing {
    public static void main(String[] args) {
        Random r = new Random();
        int num = r.nextInt(100) + 1;

        Scanner sc = new Scanner(System.in);
        System.out.println("请输入你要猜测的数（0-100之间）");
        while (true) {
            int guessing = sc.nextInt();
            if (guessing > num) {
                System.out.println("猜大了，请重新输入");
            } else if (guessing < num) {
                System.out.println("猜小了，请重新输入");
            } else {
                System.out.println("恭喜你猜对了！");
                break;
            }
        }
    }
}
